#include <stdio.h>
#include "unistd.h"
#include "sys/time.h"
int num_sqr(int num)
{
    sleep(1);
    return num * num;
}

int main()
{
    int num[5] = {1, 2, 3, 4, 5};
    int sum = 0;
    struct timeval start,end;
    gettimeofday(&start, NULL);
    for (int i = 0; i < 5; i++)
    {
        sum = sum + num_sqr(num[i]);
    }
    printf("sum = %d\n", sum);
    gettimeofday(&end, NULL);
    printf("time = %ld\n", end.tv_sec - start.tv_sec);
    return 0;
    
}